import { reqProdDetail } from "@/api";
const state = {
  prodDetail: {},
};
const mutations = {
  GETPRODDETAIL(state, data) {
    state.prodDetail = data;
  },
};
const actions = {
  async getProdDetail({ commit }, skuId) {
    const result = await reqProdDetail(skuId);
    result.code === 200 && commit("GETPRODDETAIL", result.data);
  },
};
const getters = {
  categoryView(state) {
    return state.prodDetail.categoryView || {};
  },
  spuSaleAttrList(state) {
    return state.prodDetail.spuSaleAttrList || [];
  },
  skuInfo(state) {
    return state.prodDetail.skuInfo || {};
  },
};
export default {
  state,
  mutations,
  actions,
  getters,
};
